<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div class="main">仓库页</div>
    <button onclick="emitAlert()">触发父页面事件</button>
    <iframe src="grandson.html" frameborder="0"></iframe>
    <script>
        function emitAlert() {
            parent.parentAlert()
        }

    </script>
</body>
<style>
    iframe {
        margin: 20px;
        border: dashed;
    }

    main {
        width: 500px;
        height: 500px;
        line-height: 500px;
        text-align: center
    }
</style>

</html>